import React, { Component } from 'react';
import axios from 'axios'
import CommentItem from './CommentItem';

class CommentShow extends Component {
    constructor(props){
        super(props);

        this.state={
            commentData: [],
            parentID: null,
            parentNickname: '',
            isComment: false
        }

        axios.get('/static/commentListData.json').then(res => {
            this.setState({
                commentData: res.data
            });
        })
    }

    render() {
        return (
            <div>
                <div style={{
                    height: 50,
                    width: '100%',
                    backgroundColor: '#eee'
                }}></div>
                <div style={{
                    borderRadius: 20,
                    paddingLeft: 20,
                    fontWeight: 'bold',
                    fontSize: 20,
                    paddingTop: 20
                }}>评论</div>
                {
                    this.state.commentData.map((item, index)=>{
                        return <CommentItem item={item} key={index}/>
                    })
                }
            </div>
        );
    }
}

export default CommentShow;